#include "detector.h"
#include <memory>

int main(int argc, char** argv) {
  

  std::string engine_path = "/home/lin/ros_code/tensorrt_ws/src/lidar2cam_fusion/weights/x86-FP16-n.engine";

  cv::Mat img;
  cv::VideoCapture cap("/home/lin/code/datasets/1.MP4");

  cap.set(cv::CAP_PROP_FRAME_HEIGHT, 480);
  cap.set(cv::CAP_PROP_FRAME_HEIGHT, 640);
  float conf_thresh = 0.25f;
  float nms_thresh = 0.45f;

  std::cout << "engine_path: " << engine_path << std::endl;
  std::cout << "conf_thresh: " << conf_thresh << std::endl;
  std::cout << "nms_thresh: " << nms_thresh << std::endl;


  std::shared_ptr<DetectNode> det = std::make_shared<DetectNode>(engine_path,conf_thresh,nms_thresh);

  while (cap.isOpened())
  {
    cap >> img;
    cv::resize(img, img, cv::Size(640, 480));
    det->inference(img);
    cv::imshow("11", img);
    if(cv::waitKey(10) == 'q')
      break;
    
}


  return 0;
}